<!DOCTYPE html>
<html th:lang="${language}" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
  <th:block th:include="include :: header(#{okr.my})" />
  <th:block th:include="include :: okr-css" />
</head>
<body>
<div class="col-sm-12 select-table table-striped">
  <table id="bootstrap-table"></table>
</div>

<th:block th:include="include :: footer"/>
<script th:inline="javascript">
  var prefix = "/okrAlign"
  var source = [[${source}]]
  $(function (){
            var options = {
              url : prefix + "/alignedOkr",
              columns : [
                {
                  field: 'id',
                  visible: false
                },
                {
                  field: 'userId',
                  visible: false
                },
                {
                  field: 'userName',
                  title: '用户名'
                },
                {
                  field: 'content',
                  title: 'Objective'
                },
                {
                  title: '对齐',
                  align: 'center',
                  formatter: function(value, row, index){
                    var actions = []
                    actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="cancelAlign(\'' + row.id + '\')"><i class="fa fa-edit"></i>取消对齐</a>')
                    return actions.join('')
                  }
                }
              ]
            }
            $.table.init(options)
          }
  )

  function cancelAlign(okrId){
    $.ajax({
      url: prefix + "/cancelAlign",
      type: 'POST',
      data: { "parentId" : okrId, "okrId" : source},
      success: function(data){
        $.modal.msgReload(data.msg, modal_status.SUCCESS)
      }
    })
  }
</script>
</body>
</html>